﻿@using CoreData
@model IEnumerable<Province>
@if (Model!=null&&Model.Count() > 0)
{
    int i = 0;
    <table cellpadding="0" cellspacing="0" width="100%" class="table" id="tSortable">
        <thead>
            <tr>
                <th width="20px">STT
                </th>
                <th>Mã tỉnh
                </th>
                <th>Tên tỉnh
                </th>
                <th width="60px">Chức năng
                </th>
            </tr>
        </thead>
        <tbody>
            @foreach (var item in Model)
            {
                i++;
                <tr>
                    <td>
                        @i
                    </td>
                    <td>
                      @item.Code
                    </td>
                    <td>
                        <span class="SpanId" style="display: none;">@item.ID</span>
                        <span class="SpanName" style="display: none;">@item.Name</span>
                        @item.Name
                    </td>

                    <td>
                     @if (Helper.SessionManagement.Value("pvalue").Contains("U") || Helper.SessionManagement.Value("pvalue").Contains("C"))
                     {
                        <a title="Sửa" href="@Url.Action("AddOrUpdate", "ProvinceManagement", new { id = item.ID })" class="icon-pencil"></a>
                     }
                      @if (Helper.SessionManagement.Value("pvalue").Contains("D"))
                      {
                        <a title="Xóa" href="@Url.Action("Delete", "ProvinceManagement", new { id = item.ID })" class="icon-trash" onclick="return confirm('Có chắc bạn muốn xóa ?');"></a>
                      }
                    </td>
                </tr>
            }
        </tbody>
    </table>
}
else
{
    <h2 class="error-text">Không tìm thấy dữ liệu.
    </h2>
}